< previous page page_572 next page >

Page 572
0572-02.gif
Figure 16.6
For a perfect reflector, light arrives and leaves, making
the same angle with the surface normal.
The value ks is a new specular reflection constant that depends on the particular surface. Unlike with other lighting model constants, there is only one specular constant z0592-01.gif rather than one each for the surface's red, green, and blue components. Specular reflection brightens each color component in equal amounts, so you only need one constant.
Suppose V is the unit vector from the point on the surface to the viewpoint, and R is the unit vector pointing in the direction of the angle of reflection as shown in Figure 16.8. Then you can rewrite Cosn(f) as:
e10a6a0a59f035e870d90cca05b85fce.gif
Cosn (f) = (R  V)n
Substituting this value into the previous equation gives:
e10a6a0a59f035e870d90cca05b85fce.gif
I = Ia * ka + 
    I
i * (kd * (L  N) + ks * (R  V)n) *
          (r
min + kdist) / (r + kdist)
The vectors L, N, and V are easy to calculate, but R is not. Fortunately, you can find the vector R using a little vector algebra. Figure 16.9 shows the unit vector L pointing from the surface toward the light source, and the surface's unit normal vector N. The vector B is chosen to be perpendicular to N. The vector A is the projection of the vector L along the vector N.
In terms of vector addition, A = L + B. In other words, you can get the components of vector A by adding the corresponding components of vectors L and B. For example,
z0592-04.gif
Figure 16.7
For an imperfect reflector, light leaves in directions close
to the mirror direction.

 
< previous page page_572 next page >